//
//  LJHListAlbumTableViewCell.m
//  HEARME
//
//  Created by liujinhui on 16/1/28.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHListAlbumTableViewCell.h"

@implementation LJHListAlbumTableViewCell

- (void)dealloc
{
    [_newsDigest release];
    [_newsPic release];
    [_newsTitle release];
    [_numLabel release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createCell];
    }
    
    return self;
}

-(void)createCell
{
    //排名
    self.numLabel = [[LJHBaseLable alloc] initWithFrame:CGRectMake(HEIGHT*0.01 , HEIGHT*0.08, WIDTH*0.1, HEIGHT*0.03)];
    self.numLabel.backgroundColor = [UIColor clearColor];
    self.numLabel.font = [UIFont systemFontOfSize:20 weight:1];
    [self.contentView addSubview:self.numLabel];
    self.numLabel.textAlignment = NSTextAlignmentCenter;
    self.numLabel.textColor = [UIColor colorWithRed:1 green:0.78 blue:0.73 alpha:1];
    [_numLabel release];
    
    //图片
    self.newsPic = [[UIImageView alloc] initWithFrame:CGRectMake(self.numLabel.frame.origin.x + self.numLabel.frame.size.width + HEIGHT *0.01,HEIGHT*0.01, HEIGHT*0.14, HEIGHT*0.14) ];
    self.newsPic.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.newsPic];
    [_newsPic release];
    
    //标题
    self.newsTitle = [[LJHBaseLable alloc] initWithFrame:CGRectMake(self.newsPic.frame.origin.x + self.newsPic.frame.size.width + HEIGHT*0.01, self.contentView.bounds.origin.y + HEIGHT*0.02, WIDTH *0.5, HEIGHT*0.03)];
    self.newsTitle.backgroundColor = [UIColor clearColor];
    self.newsTitle.font = [UIFont systemFontOfSize:15 weight:0];
    [self.contentView addSubview:self.newsTitle];
    [_newsTitle release];
    
    //副标题
    self.newsDigest = [[LJHBaseLable alloc] initWithFrame:CGRectMake(self.newsPic.frame.origin.x + self.newsPic.frame.size.width + HEIGHT*0.01 ,self.newsTitle.frame.origin.y + self.newsTitle.frame.size.height + HEIGHT*0.01, WIDTH *0.5, HEIGHT*0.03)];
    self.newsDigest.backgroundColor = [UIColor clearColor];
    self.newsDigest.font = [UIFont systemFontOfSize:13 weight:0];
    [self.contentView addSubview:self.newsDigest];
//    self.newsDigest.textColor = [UIColor lightGrayColor];
    self.newsDigest.numberOfLines = 3;
    [_newsDigest release];
    
    
}

-(void)setAlbumModel:(LJHAlbumModel *)albumModel
{
    if (_albumModel != albumModel) {
        [_albumModel release];
        _albumModel = [albumModel retain];
    }
    
    NSURL *url = [NSURL URLWithString:_albumModel.albumCoverUrl290];
    [self.newsPic sd_setImageWithURL:url placeholderImage:PLACEHOLDER];
    self.newsTitle.text = _albumModel.title;
    self.newsDigest.text = _albumModel.intro;
    [self.newsDigest sizeToFit];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
